home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / ABUSESRC.ZIP / AbuseSrc / macabuse / inc / light.hpp < prev    next >
C/C++ Source or Header  |  1997-05-20  |  2KB  |  77 lines

  1. #ifndef LIGHT_HPP
  2. #define LIGHT_HPP
  3.  
  4. #include "image.hpp"
  5. #include "palette.hpp"
  6. #include "config.hpp"
  7. #include "crc.hpp"
  8.  
  9. #define TTINTS 9
  10. extern uchar *tints[TTINTS];
  11. extern unsigned char *white_light,*white_light_initial,*green_light,*trans_table;
  12. extern short ambient_ramp;
  13. #define REVERSE_GREEN_TINT 8
  14.  
  15. extern short shutdown_lighting_value,shutdown_lighting;
  16.  
  17. class light_source
  18. {
  19.   public :
  20.   long type,x,xshift,y,yshift;
  21.   long outer_radius,mul_div,inner_radius;
  22.  
  23.   long x1,y1,x2,y2;
  24.   char known;
  25.   light_source *next;
  26.  
  27.   void calc_range();
  28.   light_source(char Type, long X, long Y, long Inner_radius, long Outer_radius, 
  29.            long Xshift, long Yshift,
  30.            light_source *Next);
  31.   light_source *copy();
  32. } ;
  33.  
  34. class light_patch
  35. {
  36.   public :
  37.   long total,x1,y1,x2,y2;
  38.   light_source **lights;  
  39.   light_patch *next;
  40.   light_patch(long X1, long Y1, long X2, long Y2, light_patch *Next)
  41.   { 
  42.     x1=X1; y1=Y1; x2=X2; y2=Y2;
  43.     next=Next;
  44.     total=0;
  45.     lights=NULL;
  46.   }
  47.   void add_light(long X1, long Y1, long X2, long Y2, light_source *who);
  48.   light_patch *copy(light_patch *Next);
  49.   ~light_patch() { if (total) jfree(lights); }
  50. } ;
  51.  
  52. void delete_all_lights();
  53. void delete_light(light_source *which);
  54. light_source *add_light_source(char type, long x, long y, 
  55.                    long inner, long outer, long xshift, long yshift);
  56.  
  57. void add_light_spec(spec_directory *sd, char *level_name);
  58. void write_lights(bFILE *fp);
  59. void read_lights(spec_directory *sd, bFILE *fp, char *level_name);
  60.  
  61.  
  62. void delete_patch_list(light_patch *first);
  63. light_patch *find_patch(int screenx, int screeny, light_patch *list);
  64. int calc_light_value(long x, long y, light_patch *which);                   
  65. void light_screen(image *sc, long screenx, long screeny, uchar *light_lookup, ushort ambient);
  66. void double_light_screen(image *sc, long screenx, long screeny, uchar *light_lookup, ushort ambient,
  67.              image *out, long out_x, long out_y);
  68.  
  69. void calc_light_table(palette *pal);
  70. extern light_source *first_light_source;
  71. extern int light_detail;
  72.  
  73. extern long light_to_number(light_source *l);
  74. extern light_source *number_to_light(long x);
  75.  
  76. #endif
  77.